package com.carsystem.controller;


import com.carsystem.entity.Car;
import com.carsystem.service.ICarService;
import com.carsystem.utils.PageResult;
import com.carsystem.utils.QueryPageBean;
import com.carsystem.utils.Result;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ykl
 * @since 2021-12-04
 */
@RestController
@RequestMapping("/car")
public class CarController {

    @Reference
    private ICarService carService;

    @RequestMapping("/findAllCar")
    public Result findAllCar(){
        return carService.findAllCar();
    }
    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return carService.findList(queryPageBean);
    }
    @RequestMapping("/addCar")
    public Result addCar(@RequestBody Car car){
        return carService.addCar(car);
    }
    @RequestMapping("/updateCar")
    public Result updateCar(@RequestBody Car car){
        return carService.updateCar(car);
    }
    @RequestMapping("/deleteCar")
    public Result deleteCar(int carId){
        return carService.deleteCar(carId);
    }

}

